package com.qijian.business.domain.query;

import com.baomidou.mybatisplus.annotation.TableName;
import com.qijian.common.utils.mybatis.WhereType;
import com.qijian.common.utils.mybatis.WhereTypeEnum;
import lombok.Data;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Set;


/**
 * 物料仓库对象 查询条件类
 *
 * @author qijian
 * @date 2021-09-29
 */

@Data
@ToString
@TableName("fm_store_item")
public class StoreItemQuery {

    @WhereType(filed = "id")
    private Long id;
    @WhereType(filed = "id", type = WhereTypeEnum.IN)
    private Set<Long> ids;
    @WhereType(filed = "source_id")
    private Long sourceId;
    @WhereType(filed = "source_type")
    private String sourceType;
    @WhereType(filed = "item_id")
    private Long itemId;
    @WhereType(filed = "item_id", type = WhereTypeEnum.IN)
    private Set<Long> itemIdSet;
    @WhereType(filed = "item_name", type = WhereTypeEnum.LIKE)
    private String itemName;
    @WhereType(filed = "item_code", type = WhereTypeEnum.LIKE)
    private String itemCode;
    @WhereType(filed = "item_attr", type = WhereTypeEnum.LIKE)
    private String itemAttr;
    @WhereType(filed = "org_id")
    private Long orgId;
    @WhereType(filed = "org_name", type = WhereTypeEnum.LIKE)
    private String orgName;
    @WhereType(filed = "store_id")
    private Long storeId;
    @WhereType(filed = "store_name", type = WhereTypeEnum.LIKE)
    private String storeName;
    @WhereType(filed = "location_id")
    private Long locationId;
    @WhereType(filed = "location_name", type = WhereTypeEnum.LIKE)
    private String locationName;
    @WhereType(filed = "project_no", type = WhereTypeEnum.LIKE)
    private String projectNo;
    @WhereType(filed = "qa_quantity")
    private Long qaQuantity;
    @WhereType(filed = "qa_type")
    private String qaType;
    @WhereType(filed = "production_date", type = WhereTypeEnum.BETWEEN)
    private Date[] productionDate;
    @WhereType(filed = "effective_date", type = WhereTypeEnum.BETWEEN)
    private Date[] effectiveDate;
    @WhereType(filed = "item_unit")
    private String itemUnit;
    @WhereType(filed = "item_unit_sup")
    private String itemUnitSup;
    @WhereType(filed = "quantity", type = WhereTypeEnum.GT)
    private Long quantity;
    @WhereType(filed = "quantity_sup")
    private BigDecimal quantitySup;
    @WhereType(filed = "out_quantity", func = "{2}<fm_store_item.quantity")
    private Boolean isSurplus;
    @WhereType(filed = "ancestors", tableName = "sc", func = "FIND_IN_SET({1},{2})")
    private String itemClassify;
    @WhereType(filed = "batch_no", type = WhereTypeEnum.LIKE)
    private String batchNo;


    @WhereType(ignore = true)
    private String storeIds;

    @WhereType(filed = "item_classify_name", type = WhereTypeEnum.IN)
    private List<String> itemClassifyNames;

    @WhereType(ignore = true)
    private String type;

    @WhereType(filed = "deliver_time", type = WhereTypeEnum.NOTNULL)
    private Boolean deliverTimeIsNotNull;

    @WhereType(filed = "factory_area", tableName = "fm_inventory_arrange")
    private String factoryArea;

    @WhereType(filed = "location", tableName = "fm_inventory_arrange")
    private String location;

    @WhereType(filed = "item_prop", type = WhereTypeEnum.LIKE)
    private String itemProp;

    @WhereType(ignore = true)
    private String year;

    @WhereType(ignore = true)
    private String dateStart;

    @WhereType(ignore = true)
    private String dateEnd;

    @WhereType(filed = "item_code")
    private String itemCodeEQ;

    @WhereType(filed = "item_prop")
    private String itemPropEQ;

    @WhereType(filed = "item_attr", func = " JSON_UNQUOTE( fm_store_item.item_attr -> '$.\"规格型号\"' )  = {1}")
    private String knifeItemProp;

    @WhereType(ignore = true)
    private String itemAttrEQ;

    @WhereType(ignore = true)
    private Long itemIdEQ;

    @WhereType(fields={"item_name","item_code"},type = WhereTypeEnum.LIKE)
    private String condition;

    @WhereType(filed = "item_attr_origin",type = WhereTypeEnum.LIKE)
    private String itemAttrOrigin;
}
